home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1
/
Ian and Stuart's One (Australia).iso
/
Australasian Legends
/
Commercial
/
Rainbow Hill
/
MacDOS™ 2.0.0
/
batches
/
copydir.bat
< prev
next >
Wrap
DOS Batch File
|
1994-07-01
|
1KB
|
52 lines
@echo off
! copydir.bat Batch file to copy a folder to another folder
!
! copydir name [dest]
!
! where 'name' is the folder to be copied and 'dest' is the folder which
! shall contain a copy of 'name'. Both names can be preceded by paths and
! volume IDs.
! If 'dest' is missing, the current directory is used as destination.
!
! copydir.bat calls extractName
!
! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
!
! ensure that the first parameter is there and that the third one is not
set doserr=13
if not "%3 " == " " goto ERR_LBL
if "%1 " == " " goto ERR_LBL
! ensure that the folder to be copied is there
set doserr=27
if not existdir "%1" goto ERR_LBL
! determine the destination folder
set copydir_folder=%WHERE%
if "%2 " == " " goto FOLDER_OK_LBL
if not existdir "%2" goto ERR_LBL
set copydir_folder=%2
:FOLDER_OK_LBL
! get the name of the source folder and make a directory with the same name
! in the destination folder
onerror ERR_LBL
call extractName "%1" copydir_name
if not %doserr% == 0 goto ERR_LBL
if existdir "%copydir_folder%\%copydir_name%" goto DIR_THERE_LBL
mkdir "%copydir_folder%\%copydir_name%"
:DIR_THERE_LBL
! do the copying
xcopy/e "%1" "%copydir_folder%\%copydir_name%"
goto DONE_LBL
:ERR_LBL
show %doserr%
:DONE_LBL
! remove the global variables
set copydir_name=
set copydir_folder=